﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Effects.Effects;

namespace Effects.GUI
{
    /// <summary>
    ///  Delegate for event raised by <see cref="EffectBoard"/> when some change to the board occurs.
    /// </summary>
    /// <param name="sender"> Object that has raised the event </param>
    /// <param name="e"> Event arguments </param>
    public delegate void EffectBoardChangeEventHandler(object sender, EffectBoardChangeEventArgs e);

    /// <summary>
    ///  Enumeretion of different changes that can occur to the <see cref="EffectBoard"/>
    /// </summary>
    /// <remarks>
    ///  Explanation of different changes:
    ///  <para>
    ///   <see cref="EffectBoardChangeType.effectAdded"/> - new effect has been added to the board.
    ///  </para>
    ///  <para>
    ///   <see cref="EffectBoardChangeType.effectRemoved"/> - effect has been removed from the board.
    ///  </para>
    ///  <para>
    ///   <see cref="EffectBoardChangeType.effectMoveDown"/> - effect has been moved down one position
    ///  </para>
    ///  <para>
    ///   <see cref="EffectBoardChangeType.editChanges"/> - request to allow user edit recorded parameter changes. This type is addressed to
    ///   <see cref="SettingsManagement"/> class to display dialog, containning previously recorded changes, to the user.
    ///  </para>
    /// </remarks>
    public enum EffectBoardChangeType
    { 
        /// <summary>
        ///  Indicates that new effect was added to the board
        /// </summary>
        effectAdded,       
        
        /// <summary>
        ///  Indicates that some effect has been removed from the board
        /// </summary>
        effectRemoved,    
        
        /// <summary>
        ///  Indicates that some effect has been moved down one position
        /// </summary>
        effectMoveDown,         

        /// <summary>
        ///  Inidcates that editing of changes is wanted
        /// </summary>
        editChanges             
    };


    /// <summary>
    ///  Event arguments for <see cref="EffectBoardChangeEventHandler"/>  delegate.
    /// </summary>
    /// <remarks>
    ///  <para>
    ///   This class holds information about the change that occured on the board.
    ///  </para>
    /// </remarks>
    public class EffectBoardChangeEventArgs:EventArgs
    {
        /// <summary>
        ///  Type of change.
        /// </summary>
        private EffectBoardChangeType changeType;

        /// <summary>
        ///  Gets the type of the change.
        /// </summary>
        public EffectBoardChangeType ChangeType
        {
            get { return changeType; }
        }

        /// <summary>
        ///  Specifies the number of effect that is involved in the change.
        /// </summary>
        private int effectIndex;

        /// <summary>
        ///  Gets the number of effect that is involved in the change.
        /// </summary>
        public int EffectIndex
        {
            get { return effectIndex; }
        }

        /// <summary>
        ///  Effect involved in the changes.
        /// </summary>
        private Effect effect;

        /// <summary>
        ///  Gets the Effect involved in the change
        /// </summary>
        public Effect Effect
        {
            get { return effect; }
        }

        /// <summary>
        ///  Creates new instance of EffectBoardChangeEventArgs.
        /// </summary>
        /// <param name="effectIndex"> Index of the effect that is involved in the event </param>
        /// <param name="effect"> Effect involved in the event </param>
        /// <param name="changeType"> Type of the change </param>
        public EffectBoardChangeEventArgs(int effectIndex, Effect effect,EffectBoardChangeType changeType)
        {
            this.changeType = changeType;
            this.effectIndex = effectIndex;
            this.effect = effect;
            
        }
    }
}
